home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Skunkware 5
/
Skunkware 5.iso
/
src
/
X11
/
wais
/
ftw
/
trunc.c
< prev
Wrap
C/C++ Source or Header
|
1995-05-09
|
365b
|
26 lines
#include <stdio.h>
main(argc, argv)
int argc;
char **argv;
{
int len, i, c;
if (argc != 2) {
fprintf(stderr, "Usage: %s length\n", argv[0]);
exit(-1);
}
len = atoi(argv[1]);
i = 0;
while (EOF != (c = getchar())) {
if (c == '\n') {
putchar(c);
fflush(stdout);
i = 0;
}
else if (i++ < len)
putchar(c);
}
}